package impl;

public class FactoryMethodTest {
    public static void main(String[] args) {
        IFactory factory = new PowFactory();  // 可切换成 AddFactory/SubFactory 等
        Operation oper = factory.createOperation(); //通过工厂方法创建对象
        oper.setNumberA(2);
        oper.setNumberB(2);
        double result = oper.getResult();

        System.out.println("结果是：" + result);  // 输出：结果是：4.0
    }
}
